home *** CD-ROM | disk | FTP | other *** search
/ Clickx 115 / Clickx 115.iso / software / tools / windows / tails-i386-0.16.iso / live / filesystem.squashfs / usr / share / gtksourceview-2.0 / language-specs / ocaml.lang < prev    next >
Encoding:
Extensible Markup Language  |  2010-08-16  |  9.8 KB  |  300 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!-- vim: set sts=2 sw=2: -->
  3. <!--
  4.  Author: Eric Cooper <ecc@cmu.edu>
  5.  Copyright (C) 2007 Eric Cooper <ecc@cmu.edu>
  6.  Copyright (C) 2007 Eric Norige <thelema314@gmail.com>
  7.  Copyright (C) 2009 Alexandr Kuleshov <sterh@live.ru>
  8.  
  9.  This library is free software; you can redistribute it and/or
  10.  modify it under the terms of the GNU Library General Public
  11.  License as published by the Free Software Foundation; either
  12.  version 2 of the License, or (at your option) any later version.
  13.  
  14.  This library is distributed in the hope that it will be useful,
  15.  but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  17.  Library General Public License for more details.
  18.  
  19.  You should have received a copy of the GNU Library General Public
  20.  License along with this library; if not, write to the
  21.  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  22.  Boston, MA 02111-1307, USA.
  23. -->
  24. <language id="objective-caml" _name="Objective Caml" version="2.0" _section="Sources">
  25.   <metadata>
  26.     <property name="mimetypes">text/x-ocaml</property>
  27.     <property name="globs">*.ml;*.mli;*.mll;*.mly</property>
  28.     <property name="block-comment-start">(*</property>
  29.     <property name="block-comment-end">*)</property>
  30.   </metadata>
  31.  
  32.   <styles>
  33.     <style id="comment" _name="Comment" map-to="def:comment"/>
  34.     <style id="ocamldoc" _name="Ocamldoc Comments" map-to="def:note"/>
  35.     <style id="base-n-integer" _name="Base-N Integer" map-to="def:base-n-integer"/>
  36.     <style id="floating-point" _name="Floating Point number" map-to="def:floating-point"/>
  37.     <style id="decimal" _name="Decimal number" map-to="def:decimal"/>
  38.     <style id="string" _name="String" map-to="def:string"/>
  39.     <style id="keyword" _name="Keyword" map-to="def:keyword"/>
  40.     <style id="meta-keyword" _name="Type, module or object keyword" map-to="def:keyword"/>
  41.     <style id="fun-keyword" _name="Builtin-function keyword" map-to="def:keyword"/>
  42.     <style id="type" _name="Data Type" map-to="def:type"/>
  43.     <style id="label" _name="Labeled argument" map-to="def:type"/>
  44.     <style id="poly-variant" _name="Polymorphic Variant" map-to="def:type"/>
  45.     <style id="variant" _name="Variant Constructor" map-to="def:type"/>
  46.     <style id="type-var" _name="Type Variable" map-to="def:type"/>
  47.     <style id="module" _name="Module Path" map-to="def:type"/>
  48.     <style id="escape" _name="Escaped Character" map-to="def:special-char"/>
  49.     <style id="boolean" _name="Boolean value" map-to="def:boolean"/>
  50.     <style id="error" _name="Error" map-to="def:error"/>
  51.     <style id="std-modules" _name="Standart Modules" map-to="def:type"/>
  52.   </styles>
  53.  
  54.   <definitions>
  55.     <define-regex id="cap-ident">\b[A-Z][A-Za-z0-9_']*</define-regex>
  56.     <define-regex id="low-ident">\b[a-z][A-Za-z0-9_']*</define-regex>
  57.     <define-regex id="char-esc">\\((\\|"|'|n|t|b|r)|[0-9]{3}|x[0-9a-fA-F]{2})</define-regex>
  58.  
  59.     <context id="escape-seq" style-ref="escape">
  60.       <match>\%{char-esc}</match>
  61.     </context>
  62.  
  63.     <!-- here's the main context -->
  64.     <context id="objective-caml" class="no-spell-check">
  65.       <include>
  66.     <context id="ocamldoc" style-ref="ocamldoc">
  67.       <start>\(\*\*</start>
  68.       <end>\*\)</end>
  69.       <include>
  70.         <context id="comment-in-comment" style-ref="comment" class="comment" class-disabled="no-spell-check">
  71.           <start>\(\*</start>
  72.           <end>\*\)</end>
  73.           <include>
  74.         <context ref="string"/>
  75.         <context ref="comment-in-comment"/>
  76.         <context ref="def:in-comment:*"/>
  77.           </include>
  78.         </context>
  79.         <context ref="string"/>
  80.         <context ref="def:in-comment:*"/>
  81.       </include>
  82.     </context>
  83.     <context id="comment" style-ref="comment" class="comment" class-disabled="no-spell-check">
  84.       <start>\(\*</start>
  85.       <end>\*\)</end>
  86.       <include>
  87.         <context ref="string"/>
  88.         <context ref="comment-in-comment"/>
  89.         <context ref="def:in-comment:*"/>
  90.       </include>
  91.     </context>
  92.     <context id="decimal" style-ref="decimal">
  93.       <match>[-]?[0-9][0-9_]*[lLn]?</match>
  94.     </context>
  95.     <context id="hex-number" style-ref="base-n-integer">
  96.       <match>[-]?0[xX][0-9A-Fa-f][0-9A-Fa-f_]*[lL]?</match>
  97.     </context>
  98.     <context id="octal-number" style-ref="base-n-integer">
  99.       <match>[-]?0[oO][0-7][0-7_]*[lL]?</match>
  100.     </context>
  101.     <context id="binary-number" style-ref="base-n-integer">
  102.       <match>[-]?0[bB][01][01_]*[lL]?</match>
  103.     </context>
  104.     <context id="floating-point-number" style-ref="floating-point">
  105.       <match>[-]?[0-9][0-9_]*(\.[0-9_]*)?([Ee][+-]?[0-9][0-9_]*)?</match>
  106.     </context>
  107.     <context id="label" style-ref="label">
  108.       <match>[~?]\%{low-ident}</match>
  109.     </context>
  110.     <context id="poly-variant" style-ref="poly-variant">
  111.       <match>`\%{cap-ident}</match>
  112.     </context>
  113.     <context id="modpath" style-ref="module">
  114.       <!-- include final '.'?  At the moment, no.  -->
  115.       <match>\%{cap-ident}(\.\%{cap-ident})*(?=\.)</match>
  116.     </context>
  117.     <context id="variant" style-ref="variant">
  118.       <match>\%{cap-ident}</match>
  119.     </context>
  120.     <context id="string" style-ref="string">
  121.       <start>"</start>
  122.       <end>"</end>
  123.       <include>
  124.         <context ref="escape-seq"/>
  125.       </include>
  126.     </context>
  127.     <context id="character-constant" style-ref="string">
  128.       <match>('\%{char-esc}')|('[^\\']')</match>
  129.     </context>
  130.     <context id="type-var" style-ref="type-var">
  131.       <match>'\%{low-ident}</match>
  132.     </context>
  133.     <context id="arraylit">
  134.       <start>\[\|</start>
  135.       <end>\|\]</end>
  136.       <include>
  137.         <context ref="objective-caml"/>
  138.       </include>
  139.     </context>
  140.     <context id="badarray" style-ref="error" extend-parent="false">
  141.       <match>\|\]</match>
  142.     </context>
  143.     <context id="listlit">
  144.       <start>\[</start>
  145.       <end>(?<!\|)\]</end>
  146.       <include>
  147.         <context ref="objective-caml"/>
  148.       </include>
  149.     </context>
  150.     <context id="badlist" style-ref="error" extend-parent="false">
  151.       <match>\]</match>
  152.     </context>
  153.     <context id="boolean-constant" style-ref="boolean">
  154.       <keyword>true</keyword>
  155.       <keyword>false</keyword>
  156.     </context>
  157.     <!-- Flow control & common keywords -->
  158.     <context id="keywords" style-ref="keyword">
  159.       <keyword>and</keyword>
  160.       <keyword>assert</keyword>
  161.       <keyword>begin</keyword>
  162.       <keyword>do</keyword>
  163.       <keyword>done</keyword>
  164.       <keyword>downto</keyword>
  165.       <keyword>else</keyword>
  166.       <keyword>end</keyword>
  167.       <keyword>for</keyword>
  168.       <keyword>fun</keyword>
  169.       <keyword>function</keyword>
  170.       <keyword>if</keyword>
  171.       <keyword>in</keyword>
  172.       <keyword>let</keyword>
  173.       <keyword>match</keyword>
  174.       <keyword>rec</keyword>
  175.       <keyword>then</keyword>
  176.       <keyword>to</keyword>
  177.       <keyword>try</keyword>
  178.       <keyword>val</keyword>
  179.       <keyword>when</keyword>
  180.       <keyword>while</keyword>
  181.       <keyword>with</keyword>
  182.     </context>
  183.     <!-- types, objects and modules -->
  184.     <context id="meta-words" style-ref="meta-keyword">
  185.       <keyword>as</keyword>
  186.       <keyword>class</keyword>
  187.       <keyword>constraint</keyword>
  188.       <keyword>exception</keyword>
  189.       <keyword>external</keyword>
  190.       <keyword>functor</keyword>
  191.       <keyword>include</keyword>
  192.       <keyword>inherit</keyword>
  193.       <keyword>initializer</keyword>
  194.       <keyword>method</keyword>
  195.       <keyword>module</keyword>
  196.       <keyword>mutable</keyword>
  197.       <keyword>new</keyword>
  198.       <keyword>object</keyword>
  199.       <keyword>of</keyword>
  200.       <keyword>open</keyword>
  201.       <keyword>private</keyword>
  202.       <keyword>struct</keyword>
  203.       <keyword>sig</keyword>
  204.       <keyword>type</keyword>
  205.       <keyword>virtual</keyword>
  206.     </context>
  207.     <context id="function-keywords" style-ref="fun-keyword">
  208.       <!-- function-like keywords -->
  209.       <keyword>asr</keyword>
  210.       <keyword>land</keyword>
  211.       <keyword>lazy</keyword>
  212.       <keyword>lor</keyword>
  213.       <keyword>lsl</keyword>
  214.       <keyword>lsr</keyword>
  215.       <keyword>lxor</keyword>
  216.       <keyword>mod</keyword>
  217.       <keyword>or</keyword>
  218.       <!-- from pervasives, but same as others -->
  219.       <keyword>lnot</keyword>
  220.     </context>
  221.     <context id="types" style-ref="type">
  222.       <!-- pervasives types -->
  223.       <keyword>option</keyword>
  224.       <keyword>ignore</keyword>
  225.       <keyword>ref</keyword>
  226.       <keyword>array</keyword>
  227.       <keyword>bool</keyword>
  228.       <keyword>char</keyword>
  229.       <keyword>float</keyword>
  230.       <keyword>int</keyword>
  231.       <keyword>list</keyword>
  232.       <keyword>string</keyword>
  233.       <keyword>unit</keyword>
  234.     </context>
  235.     <context id="standart-modules" style-ref="std-modules">
  236.       <!--Standart modules -->
  237.       <keyword>arg</keyword>
  238.       <keyword>arith_status</keyword>
  239.       <keyword>array</keyword>
  240.       <keyword>arrayLabels</keyword>
  241.       <keyword>big_int</keyword>
  242.       <keyword>bigarray</keyword>
  243.       <keyword>buffer</keyword>
  244.       <keyword>callback</keyword>
  245.       <keyword>camlinternalMod</keyword>
  246.       <keyword>camlinternalOO</keyword>
  247.       <keyword>char</keyword>
  248.       <keyword>complex</keyword>
  249.       <keyword>condition</keyword>
  250.       <keyword>dbm</keyword>
  251.       <keyword>digest</keyword>
  252.       <keyword>dynLink</keyword>
  253.       <keyword>event</keyword>
  254.       <keyword>filename</keyword>
  255.       <keyword>format</keyword>
  256.       <keyword>gc</keyword>
  257.       <keyword>genlex</keyword>
  258.       <keyword>graphics</keyword>
  259.       <keyword>graphicsX11</keyword>
  260.       <keyword>hashtbl</keyword>
  261.       <keyword>int32</keyword>
  262.       <keyword>int64</keyword>
  263.       <keyword>largeFile</keyword>
  264.       <keyword>lazy</keyword>
  265.       <keyword>lexing</keyword>
  266.       <keyword>list</keyword>
  267.       <keyword>listLabels</keyword>
  268.       <keyword>map</keyword>
  269.       <keyword>marshal</keyword>
  270.       <keyword>moreLabels</keyword>
  271.       <keyword>mutex</keyword>
  272.       <keyword>mativeint</keyword>
  273.       <keyword>num</keyword>
  274.       <keyword>oo</keyword>
  275.       <keyword>parsing</keyword>
  276.       <keyword>printexc</keyword>
  277.       <keyword>printf</keyword>
  278.       <keyword>queue</keyword>
  279.       <keyword>random</keyword>
  280.       <keyword>scanf</keyword>
  281.       <keyword>set</keyword>
  282.       <keyword>sort</keyword>
  283.       <keyword>stack</keyword>
  284.       <keyword>stdLabels</keyword>
  285.       <keyword>str</keyword>
  286.       <keyword>stream</keyword>
  287.       <keyword>stringLabels</keyword>
  288.       <keyword>sys</keyword>
  289.       <keyword>thread</keyword>
  290.       <keyword>threadUnix</keyword>
  291.       <keyword>unix</keyword>
  292.       <keyword>unixLabels</keyword>
  293.       <keyword>weak</keyword>
  294.       <!-- Standart modules -->
  295.     </context>
  296.       </include>
  297.     </context>
  298.   </definitions>
  299. </language>
  300.